public class demo2 {
    public static int[] fib(int n){
        int[] nums = new int[n+1];
        nums[0] = 0;
        nums[1] = 1;
        for (int i = 2; i < nums.length; i++) {
            nums[i] = nums[i-1] + nums[i-2];
        }
        return nums;
    }
    public static void main(String[] args) {
        int[] ret = fib(10);
        for (int i = 0; i < ret.length; i++) {
            System.out.print(ret[i]+" ");
        }

    }
}
